<template>
  <el-table
    :data="tableData.filter(data => !search || data.name.toLowerCase().includes(search.toLowerCase()))"
    style="width: 100%"
  >
    <el-table-column
      label="作业标题"
      prop="workTitle"
    />
    <el-table-column
      label="提交"
      prop="submitNumber"
    />
    <el-table-column
      label="评阅方式"
      prop="pyMethod"
    />
  </el-table>
</template>
<script>

import request from '@/utils/request'

export default {
  name: 'Index',
  data() {
    return {
      tableData: [{
        id: '',
        workTitle: '',
        submitNumber: '',
        pyMethod: ''
      }],
      search: ''
    }
  },
  mounted() {
    var userId = localStorage.getItem('userId')
    this.WorkData(userId)
  },
  methods: {
    WorkData(userId) {
      request.get('/GetWorkData/' + userId).then((res) => {
        console.log(res.data)
        this.tableData = res.data
      })
    }
  }
}
</script>

<style scoped>

</style>
